package com.xmy.cultivate.schedule;

import com.xmy.cultivate.service.IStudentGradeService;
import com.xmy.cultivate.util.SpringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 更新分班信息最后一条数据为1
 */
public class UpdateNotIsLastJob implements Job {

    @Autowired
    IStudentGradeService iStudentGradeService = SpringUtils.getBean(IStudentGradeService.class);

    private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    private void before() {
        System.out.println("任务UpdateNotIsLastJob：开始执行-" + dateFormat.format(new Date()));
    }

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        before();
        //iRecordCourseService = (IRecordCourseService) SpringContextJobUtil.getBean("iRecordCourseService");
        iStudentGradeService.updateNotIsLast(null,null);
        //iPatriarchService.testPush();
        after();
    }

    private void after() {
        System.out.println("任务UpdateNotIsLastJob：执行结束");
        //System.out.println();
    }
}
